package com.boot.boot2.controller;

import com.boot.boot2.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by Wuxiang on 2017/12/13.
 */
@RestController
public class IndexController {

    @Autowired
    ConfigService configService;

    @RequestMapping("/")
    public String main() {
        System.out.println("配置项：person.name=" + configService.getPersonName());
        System.out.println("配置项：person.address=" + configService.getPersonAddress());
        System.out.println("配置项：person.age=" + configService.getPersonAge());
        System.out.println("配置项：person.sex=" + configService.getPersonSex());

        System.out.println("配置项：author.name=" + configService.getAutherName());
        System.out.println("配置项：author.age=" + configService.getAutherAge());
        return "Welcome to IndexController";
    }

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView view = new ModelAndView("index");
        return view;
    }
}
